<template>
	<view>
		<daya-clone-navbar :prop_clone_navbar="clone_navbar" :prop_is_ipx="is_ipx" />

		<view v-if="show_subs==true && store_subs.length>0" class="drawer_screen">
			<view class="drawer_box p-8">
				<view class="w-full text-xl text-center">
					关联店铺
				</view>
				<view @click="gotoStore(item.id)" class="my-2 flex justify-between items-center" v-for="item in store_subs"
					:key="item.id">
					<view class="left-item">
						<view class="name">
							{{ item.name }}
						</view>
						<view class="address">
							{{ item.address }}
						</view>
					</view>
					<image class="right-item" src="/static/ymq_canyino2o/arrow-right.png" mode=""></image>
					<!-- <view>
					<button class="w-full bg-blue-500 btn-green" @click="close_store_subs_drawer">关闭</button>
				</view> -->
				</view>
				
				<image class="close" src="/static/ymq_canyino2o/close.png" mode="" @click="close_store_subs_drawer"></image>
			</view>
		</view>

		<view class="navbar flex-row" style="border: 1rpx solid #d5d5d5" v-if="xtxx.model == '1'">
			<navigator class="flex-grow-1 flex-y-center" openType="reLaunch" :url="item.url" v-for="(item, index) in arr"
				:key="index">
				<view>
					<image class="navbar-icon" :src="item.logo2"></image>
					<view class="navbar-text" :style="'color: ' + item.title_color2 + ';'">{{ item.title }}</view>
				</view>
			</navigator>
		</view>
		<view :class="'main ' + (hbtoggle ? 'stopgd' : '')">
			<view class="seller_info">
				<view class="logo">
					<!-- <view class="scimg-box" v-for="(item, index) in store.environment" :key="index">
						<image @tap="previewImage" class="scimg" :data-urls="store.environment" :id="item" :src="item"></image>
					</view> -->
					<image :src="store.logo" mode="" style="width: 100%;"></image>
				</view>
				<!-- <view @tap="gbbjyy" class="copyrights">
					<image class="himg" mode="aspectFill"
						src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/seller_info_img.png"></image>
					<view>商家详情</view>
					<image :class="'yyimg ' + (bjyylb == 'laba' ? 'Rotation' : '')"
						src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/sjyy.png"
						v-if="store_info.store_mp3 != '' && store_info.is_mp3 == '1'"></image>
				</view> -->
				<view class="seller_head">
					<view class="name">
						{{ store_info.name }}
					</view>
					<view class="pf">
						<view class="score">
							<image src="/static/ymq_canyino2o/score.png" mode="" v-for="item in 5"></image>
							<text>{{ store_info.sales }}</text>
						</view>
						<view class="comment">
							{{ store_info.capita }}条
						</view>
						<view>￥{{ store_info.capita }}/人</view>
					</view>
					<view class="time">
						<view v-if="time == '1'">营业中</view>
						<view v-if="time == '2'">未开店</view>
						<view v-if="time == '3'">关店</view>
						<view>
							{{ store_info.time3 }}-{{ store_info.time4 }}
						</view>
					</view>
					<view class="address">
						<view class="address-left">
							<view class="">
								{{ store_info.address }}
							</view>
							<!-- <view class="">
									{{ store_info.address }}
							</view> -->
						</view>
						<view class="address-right">
							<view @tap="seller_info" class="selleradd" style="padding-right: 20rpx; border-right: 1rpx solid #d5d5d5">
								<image src="/static/ymq_canyino2o/dh.png"></image>
								<view>导航</view>
							</view>
							<view @tap="maketel" class="selleradd">
								<image src="/static/ymq_canyino2o/dianhua.png"></image>
								<view>电话</view>
							</view>
						</view>
					</view>
					<navigator class="weui-cell weui-cell_access sjhj" hoverClass="weui-cell_active" url="infomation">
						<view class="weui-cell__hd">
							<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/personal/intergal.png"
								style="margin-right: 5px; width: 30rpx; height: 30rpx"></image>
						</view>
						<view class="weui-cell__bd">商家环境</view>
						<view class="weui-cell__ft weui-cell__ft_in-access"></view>
					</navigator>
					
				</view>

				<!-- <view class="weui-cells weui-cells_after-title">
					<view class="weui-cell weui-cell_access" hoverClass="weui-cell_active">
						<view class="weui-cell__hd">
							<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/xiuxi.png"
								style="margin-right: 5px; width: 30rpx; height: 30rpx"></image>
						</view>
						<view class="weui-cell__bd">
							营业时间：
							<text>{{ store_info.time }}-{{ store_info.time2 }}</text>
							<text style="margin-left: 20rpx"
								v-if="store_info.time3 != '' && store_info.time4 != ''">{{ store_info.time3 }}-{{ store_info.time4 }}</text>
						</view>
						<view class="weui-cell__ft"></view>
					</view>
					<navigator class="weui-cell weui-cell_access" hoverClass="weui-cell_active">
						<view class="weui-cell__hd">
							<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/address.png"
								style="margin-right: 5px; width: 30rpx; height: 35rpx"></image>
						</view>
						<view class="weui-cell__bd">{{ store_info.address }}</view>
						<view class="weui-cell__ft flex-row">
							<view @tap="seller_info" class="selleradd" style="padding-right: 20rpx; border-right: 1rpx solid #d5d5d5">
								<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/car.png"></image>
								<view>导航</view>
							</view>
							<view @tap="maketel" class="selleradd">
								<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/phone.png"></image>
								<view>电话</view>
							</view>
						</view>
					</navigator>
					<navigator class="weui-cell weui-cell_access" hoverClass="weui-cell_active" url="infomation">
						<view class="weui-cell__hd">
							<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/personal/intergal.png"
								style="margin-right: 5px; width: 30rpx; height: 30rpx"></image>
						</view>
						<view class="weui-cell__bd">商家环境</view>
						<view class="weui-cell__ft weui-cell__ft_in-access"></view>
					</navigator>
				</view> -->
			</view>
			<view class="seller_nav" v-if="storeset.info_style == '1'">
				<view class="title">店铺支持</view>
				<view class="nav-content" style="display: flex; flex-wrap: wrap">
					<view @tap="goUrl(item.bindtap)" v-if="item.active" v-for="(item, index) in nav" :key="index">
						<image mode="aspectFit" :src="item.img"></image>
						{{ item.name }}
					</view>
				</view>
			</view>
			<view class="seller_nav2" v-if="storeset.info_style == '2'">
				<!--商家导航风格2 @tap="item.bindtap" -->
				<view @tap="goUrl(item.bindtap)" class="seller_nav2view" v-if="item.active" v-for="(item, index) in nav"
					:key="index">
					<view class="seller_nav2viewleft flex-grow-1">
						<view>{{ item.name }}</view>
						<view>{{ item.smwz }}</view>
					</view>

					<image mode="aspectFit" :src="item.img"></image>
				</view>
			</view>
			<view>
				<!-- #ifdef MP-WEIXIN -->
				<!-- [miniprogram-to-uniapp] 公众号关注组件 仅微信小程序支持 -->
				<official-account></official-account>
				<!-- #endif -->

				<!-- #ifndef MP-WEIXIN -->
				<view>
					<!--当前为非微信小程序环境，不支持公众号关注组件，请自行调整当前节点内容！-->
				</view>
				<!-- #endif -->
			</view>
			<ad :unitId="item.src" v-for="(item, index) in dbllz" :key="index"></ad>
			<view class="shop_info">
				<view class="shop_info_0">
					<block v-if="tjcarr.length">
						<view class="shop_info_border_1" v-if="index == 1">商品推荐</view>
						<view @tap="seller_dishes" class="shop_info_border_0" v-else>商品推荐</view>
					</block>
					<view class="shop_info_border_1" v-if="index == 0">优惠券</view>
					<view @tap="seller_coupon" class="shop_info_border_0" v-else>优惠券</view>
					<view class="shop_info_border_1" v-if="index == 2">评价</view>
					<view @tap="seller_evalate" class="shop_info_border_0" v-else>评价</view>
				</view>
				<view class="shop_coupon transtion" v-if="index == 0">
					<view></view>
					<view>
						<view class="yhq flex-row" v-for="(item, index) in Coupons" :key="index">
							<view class="yhqleft flex-col">
								<view class="hyuan1"></view>
								<view class="hyuan2"></view>
								<view class="yhqlefttop flex-grow-0 flex-y-center">
									<view class="yhqmoney">
										{{ item.reduce }}
										<text>元</text>
									</view>
									<view class="flex-grow-1 flex-col flex-x-center">
										<view class="yhqname gobyndsingle">{{ item.name }}</view>
										<view>满{{ item.full }}可用</view>
										<view class="yhtype" v-if="item.type == '1'">店外可用</view>
										<view class="yhtype" v-if="item.type == '2'">店内可用</view>
										<view class="yhtype" v-if="item.type == '3'">店内店外</view>
									</view>
								</view>
								<view class="yhqleftfoot flex-grow-1">
									<view class="flex-grow-1 flex-y-center yhqtime">有效期：{{ item.start_time }}至{{ item.end_time }}</view>
								</view>
							</view>

							<view class="yhqright flex-col flex-x-center flex-y-center" v-if="item.state == '2' && item.sysl < 100">
								<view class="circle">
									<view class="pie_left">
										<view class="left" v-if="item.sysl < 51"></view>
										<view class="left" :style="
                        'transform: rotate(' + (item.sysl * 3.6 - 180) + 'deg)'
                      " v-else></view>
									</view>
									<view class="pie_right">
										<view class="right" :style="'transform: rotate(' + item.sysl * 3.6 + 'deg)'" v-if="item.sysl < 51">
										</view>
										<view class="right" style="transform: rotate(180deg)" v-else></view>
									</view>
									<view class="mask flex-col flex-x-center">
										<view>已抢</view>
										<view>{{ item.sysl }}%</view>
									</view>
								</view>
								<view @tap="ljlq" class="ljlq" :data-qid="item.id">立即领取</view>
							</view>

							<view class="yhqright flex-col flex-x-center flex-y-center"
								style="background: #ffac00; border-left: 5rpx dotted #f19b09" v-if="item.state == '1'">
								<view class="ylq">
									<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/ylq.png"></image>
								</view>
								<view @tap="qsy" class="ljlq1" :data-type="item.type">去使用</view>
							</view>

							<view class="yhqright flex-col flex-x-center flex-y-center"
								style="background: #fff; border-left: 5rpx dotted #bfbfbf" v-if="item.state == '2' && item.sysl == 100">
								<view class="ylq">
									<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/yqg.png"></image>
								</view>
								<view class="ljlq2">已抢光</view>
							</view>
						</view>
						<view class="kong" style="background: #fff" v-if="Coupons.length == 0">
							<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/wushuju.png"></image>
							<view>暂无优惠券</view>
						</view>
					</view>
				</view>
				<view class="recomed_deshes" v-if="index == 1" @tap="takeout">
					<view class="dishes_list" v-for="(item, index) in tjcarr" :key="index">
						<view>
							<image mode="aspectFill" :src="item.logo"></image>
						</view>

						<view class="dishes_info">
							<view class="gobyndsingle">{{ item.name }}</view>
							<view>
								<text>￥{{ item.money }}元</text>
								<text>￥{{ item.money2 }}元</text>
							</view>
							<view>{{ item.discount }}折</view>
							<view class="cplbright3 flex-row flex-y-center wzbl" v-if="
                  xtxx.hygn == '1' &&
                  item.vip_money != '0.00' &&
                  item.is_gg != '2'
                ">
								<view class="vipzx dwab" style="
                    height: auto;
                    font-size: 20rpx;
                    font-weight: normal;
                  ">会员价：￥{{ item.vip_money }}</view>
							</view>
						</view>

						<view class="buy">
							<view>马上抢</view>
							<view>已销{{ item.sales }}份</view>
						</view>
					</view>
					<view class="kong" v-if="tjcarr.length == 0">
						<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/wushuju.png"></image>
						<view>暂无相关数据</view>
					</view>
				</view>
				<view class="evaluate" v-if="index == 2">
					<view class="evaluate_head">
						<text>综合评分</text>
						<text>{{ store_info.sales }}分</text>
					</view>
					<view class="evaluate_label">
						<view @tap="selectednavbar" :data-index="index" :style="
                'color:' +
                (selectedindex == index ? '#fff' : '') +
                ';background-color: ' +
                (selectedindex == index ? color : '') +
                ';border:' +
                (selectedindex == index ? 'none' : '')
              " v-for="(item, index) in navbar" :key="index">
							{{ item.name }}{{ item.num }}
						</view>
					</view>
					<view @tap="ytpj" class="graph rel">
						<text class="ab ud" v-if="!isytpj"></text>
						<icon class="ab ud" :color="color" size="17" style="height: 35rpx; display: inline-block" type="success"
							v-else></icon>
						<text>有图评价</text>
					</view>
					<view class="evaluate_list" v-for="(item, index) in storelist" :key="index">
						<view class="list_head">
							<image mode="aspectFill" :src="item.user_img"></image>
						</view>

						<view>
							<view class="plname">{{ item.name }}</view>
							<view class="pltime flex-bet flex-y-center">
								<view class="flex-row flex-grow-1 flex-y-center">
									<view class="pfimg">
										<view class="kximg">
											<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/i-star.png"></image>
										</view>
										<view class="sximg" :style="'width: ' + item.stars * 20 + '%'">
											<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/i-stars.png"></image>
										</view>
									</view>
								</view>
								<view class="flex-grow-0 flex-row flex-y-center">{{
                  item.time
                }}</view>
							</view>
							<view style="margin: 20rpx 0">
								<image @tap="commentPicView" class="evaluate_image" :data-id="item.id" :data-index="index"
									:data-picindex="picindex" mode="aspectFill" :src="image_url + item1"
									v-for="(item1, picindex) in item.img" :key="picindex"></image>
							</view>
							<view>{{ item.content }}</view>
							<view class="sjhf" v-if="item.hf != ''">商家回复：{{ item.hf }}</view>
						</view>
					</view>
					<view class="jzz" v-if="!mygd">
						<image class="Rotation" src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/jzz.png"></image>
						<view>加载中...</view>
					</view>
					<view class="kong" v-if="storelist.length == 0 && mygd">
						<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/wushuju.png"></image>
						<view>暂无相关数据</view>
					</view>
					<view class="jzwb" v-if="mygd">
						<view class="hx"></view>
						<view class="wz">加载完毕</view>
						<view class="hx"></view>
					</view>
				</view>
			</view>
			<view class="copyright">
				<navigator :appId="xtxx.tz_appid" class="copyright_logo" extraData="" openType="navigate" path=""
					target="miniProgram" version="release">
					<image class="copyright_img" mode="aspectFill" :src="xtxx.bq_logo"></image>
					<view class="copyright_text">{{ xtxx.bq_name }}</view>
				</navigator>
				<view class="copyright_txt">{{ xtxx.support }}</view>
			</view>
		</view>
		<view class="kjdhzz" v-if="opendh"></view>
		<view class="kjdhv">
			<view @tap="opennav" class="kjdh">快捷导航</view>
			<image @tap="opennav" class="kjdhx" src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/dhclose.png"
				:style="'background:' + color" v-if="opendh"></image>
			<view :class="'kjlb ' + (opendh ? 'kjlb-show' : 'kjlb-hide')">
				<view @tap="sjmp" class="kjlbv">
					<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/sjzl.png"></image>
					<view>联系商家</view>
				</view>
				<navigator class="kjlbv" openType="reLaunch" url="/ymq_canyino2o/pages/index/index" v-if="xtxx.model == '1'">
					<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/gssjjs.png"></image>
					<view>首页</view>
				</navigator>
				<navigator class="kjlbv" openType="reLaunch" url="/ymq_canyino2o/pages/wddd/order">
					<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/gssj.png"></image>
					<view>订单</view>
				</navigator>
				<navigator class="kjlbv" openType="reLaunch" url="/ymq_canyino2o/pages/my2/index">
					<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/gstel.png"></image>
					<view>我的</view>
				</navigator>
			</view>
		</view>
		<view @tap="mdoalclose" class="modalzz" v-if="!mdoaltoggle"></view>
		<view class="mpmodal" v-if="!mdoaltoggle">
			<view class="modalbd">
				<view class="modaltitle">联系我们</view>
				<image @tap="previewImage" :src="store_info.qrcode"></image>
				<view class="modalft">点击图片预览保存图片</view>
			</view>
		</view>
		<view class="tjhbzz" v-if="hbtoggle"></view>
		<view :class="
        'tjhbcell flex-col flex-y-center ' +
        (hbtoggle ? 'tjhb-show' : 'tjhb-hide')
      " v-if="hbtoggle">
			<view class="tjhbbd">
				<image class="tjhbbdimg" mode="widthFix" src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/hbhead.png">
				</image>
				<view class="hbtitle1">送你 {{ wlqyhq.length }} 个红包</view>
				<view class="hbtitle2">赶快下单使用吧 !</view>
				<view class="tjhbbdcv">
					<view class="tjhbbdc">
						<view class="bbcell flex-row" v-for="(item, index) in wlqyhq" :key="index">
							<view class="bbcelll flex-col flex-x-center flex-y-center">
								<view class="bby1"></view>
								<view class="bby2"></view>
								<view class="bbm">
									<text>￥</text>
									{{ item.reduce }}
								</view>
								<view class="bbf">满{{ item.full }}可用</view>
							</view>

							<view class="bbcellr flex-grow-1 flex-row flex-y-center">
								<view class="flex-grow-1 flex-col flex-x-center">
									<view class="bbname gobyndsingle">{{ item.name }}</view>
									<view class="bbtime">有效期至:{{ item.end_time }}</view>
								</view>
								<view class="flex-grow-0 flex-col flex-x-center flex-y-center">
									<view class="bbtype" v-if="item.type == '1'">店外可用</view>
									<view class="bbtype" v-if="item.type == '2'">店内可用</view>
									<view class="bbtype" v-if="item.type == '3'">店内店外</view>
									<view @tap="ljlq" class="bblq" :data-qid="item.id" v-if="item.state == '2' && item.sysl < 100">立即领取
									</view>
									<view @tap="qsy" class="bblq bbsy" :data-type="item.type" v-if="item.state == '1'">立即使用</view>
									<view class="bblq bbqg" v-if="item.state == '2' && item.sysl == 100">已经抢光</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<image @tap="closehbtoggle" class="tjhbft" src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/gbpd.png">
			</image>
		</view>
		<gettel v-if="userinfo && !userinfo.user_tel && xtxx.is_tel == 1"></gettel>

	</view>
</template>

<script>
	import cardlist from '@/ymq_canyino2o/dist/cardlist/index'
	import gettel from '@/ymq_canyino2o/dist/gettel/index'
	var app = getApp()
	var util = require('../../utils/util.js')
	export default {
		components: {
			cardlist,
			gettel
		},
		data() {
			return {
				show_subs: false,
				store_subs: [],
				image_url: '',
				index: 1,
				navbar: [],

				nav: [{
						bindtap: 'takeout',
						img: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/two.png',
						name: '外卖',
						active: false,
						smwz: '快速送达'
					},
					{
						bindtap: 'smdc',
						img: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/six.png',
						name: '扫码点餐',
						active: false,
						smwz: '扫一扫轻松下单'
					},
					{
						bindtap: 'plan',
						img: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/one.png',
						name: '预约',
						active: false,
						smwz: '提前预定'
					},
					{
						bindtap: 'sy',
						img: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/four.png',
						name: '收银',
						active: false,
						smwz: '当面收款'
					},
					{
						bindtap: 'qg',
						img: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/yysj.png',
						name: '抢购',
						active: false,
						smwz: '限时抢购'
					},
					{
						bindtap: 'pt',
						img: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/zdjd.png',
						name: '拼团',
						active: false,
						smwz: '拼团活动'
					},
					{
						bindtap: 'pdqh',
						img: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/eight.png',
						name: '排队取号',
						active: false
					},
					{
						bindtap: 'cj',
						img: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/three.png',
						name: '存酒',
						active: false
					},
					{
						bindtap: 'hjfwy',
						img: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/five.png',
						name: '呼叫服务员',
						active: false
					},
					{
						bindtap: 'yhq',
						img: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/seller/seven.png',
						name: '优惠券',
						active: false
					}
				],

				selectedindex: 0,
				isytpj: false,
				pagenum: 1,
				storelist: [],
				bfstorelist: [],
				mygd: false,
				jzgd: true,

				arr: [{
						logo: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/tabindexf.png',
						logo2: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/tabindex.png',
						title: '首页',
						title_color: '#34aaff',
						title_color2: '#888',
						url: '/ymq_canyino2o/pages/index/index'
					},
					{
						logo: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/tabddf.png',
						logo2: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/tabdd.png',
						title: '订单',
						title_color: '#34aaff',
						title_color2: '#888',
						url: '/ymq_canyino2o/pages/wddd/order'
					},
					{
						logo: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/tabmyf.png',
						logo2: 'https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/tabmy.png',
						title: '我的',
						title_color: '#34aaff',
						title_color2: '#888',
						url: '/ymq_canyino2o/pages/my2/index'
					}
				],

				bjyylb: 'laba',
				opendh: false,
				mdoaltoggle: true,
				params: {},
				store: {
					details: '',
					store_video: [],
					environment: '',
					yyzz: ''
				},
				xtxx: {
					model: '',
					hygn: '',
					tz_appid: '',
					bq_logo: '',
					bq_name: '',
					support: '',
					is_tel: 0
				},

				dbllz: [],
				slider: '',
				tjcarr: '',

				userinfo: {
					user_tel: ''
				},

				hbtoggle: false,
				isjzz: false,
				Coupons: '',
				wlqyhq: '',

				store_info: {
					logo: '',
					store_mp3: '',
					is_mp3: '',
					name: '',
					capita: '',
					time: '',
					time2: '',
					time3: '',
					time4: '',
					address: '',
					sales: '',
					qrcode: ''
				},

				storeset: {
					info_style: ''
				},

				paytel: '',
				time: 0,


				color: '',
				picindex: 0

			}
		},
		onLoad: function(t) {
			var that = this
			app.globalData.setNavigationBarColor(this)
			this.appPageOnLoad(app);

			var a = decodeURIComponent(t.scene)
			console.log('scene', a)
			if ('undefined' != a) {
				getApp().globalData.sjid = a
			}
			if (null != t.sjid) {
				console.log('转发获取到的sjid:', t.sjid)
				getApp().globalData.sjid = t.sjid
			}
			console.log(t, getApp().globalData.sjid)
			this.setData({
				params: {
					store_id: getApp().globalData.sjid,
					type: '全部',
					img: ''
				}
			})
			this.reLoad()
			this.getstorelist()
			this.load_store_subs()
			that.refresh(getApp().globalData.sjid)
			// app.globalData.util.request({
			//   url: 'entry/wxapp/system',
			//   cachetime: '0',
			//   success: function (t) {
			//     console.log(t)
			//     var a = t.data
			//     getApp().globalData.xtxx1 = a
			//     app.globalData.appPageOnLoad(that)
			//     that.setData({
			//       xtxx: a
			//     })
			//   }
			// })
			app.globalData.util.request({
				url: 'entry/wxapp/Llz',
				cachetime: '0',
				data: {
					type: '5'
				},
				success: function(t) {
					console.log(t)
					that.setData({
						dbllz: t.data
					})
				}
			})
			app.globalData.util.request({
				url: 'entry/wxapp/StoreAd',
				cachetime: '0',
				data: {
					store_id: getApp().globalData.sjid
				},
				success: function(t) {
					console.log(t.data)
					that.setData({
						slider: t.data
					})
				}
			})
			app.globalData.util.request({
				url: 'entry/wxapp/TjGoods',
				cachetime: '0',
				data: {
					store_id: getApp().globalData.sjid
				},
				success: function(t) {
					console.log(t.data)
					for (var a = 0; a < t.data.length; a++) {
						t.data[a].discount = (
							(Number(t.data[a].money) / Number(t.data[a].money2)) *
							10
						).toFixed(1)
					}
					that.setData({
						index: t.data.length ? 1 : 0,
						tjcarr: t.data
					})
				}
			})

		},
		onReady: function() {},
		onShow: function() {
			var that = this
			app.globalData.getUserInfo(function(t) {
				console.log(t)
				that.CouponsFun()
				that.setData({
					userinfo: t
				})
			})
		},
		onHide: function() {},
		onUnload: function() {
			// #ifdef MP-WEIXIN
			uni.stopBackgroundAudio()
			// #endif
		},
		onPullDownRefresh: function() {},
		onReachBottom: function() {
			console.log('上拉加载', this.pagenum)
			this.mygd ||
				!this.jzgd ||
				this.isjzz ||
				(this.setData({
						jzgd: false
					}),
					this.getstorelist())
		},
		onShareAppMessage: function() {
			var t = this.xtxx
			console.log(t)
			return {
				title: this.store_info.name,
				path: '/ymq_canyino2o/pages/seller/index?sjid=' + this.store_info.id,
				success: function(t) {},
				fail: function(t) {}
			}
		},
		onShareTimeline: function() {
			var t = this.xtxx
			console.log(t)
			return {
				title: this.store_info.name,
				path: '/ymq_canyino2o/pages/seller/index?sjid=' + this.store_info.id,
				success: function(t) {},
				fail: function(t) {}
			}
		},
		methods: {
			gotoStore(id) {
				uni.navigateTo({
					url: '/ymq_canyino2o/pages/seller/index?sjid=' + id
				})
			},
			close_store_subs_drawer() {
				//当前店铺 关闭订阅消息弹窗,并且缓存起来,时间1小时过期
				let sjid = getApp().globalData.sjid
				//当前时间加1小时
				let time = new Date().getTime() + 1 * 60 * 60 * 1000
				uni.setStorageSync('store_subs_' + sjid, time)
				this.store_subs = [];
				// uni.showToast({
				//   title: '1小时不再提醒关联店铺',
				//   icon: 'none'
				// })
			},
			load_store_subs: function() {
				if (getApp().globalData.sjid == null || getApp().globalData.sjid == undefined || getApp().globalData.sjid ==
					'') {
					return
				}

				let sjid = getApp().globalData.sjid
				//获取缓存,如果缓存不存在,或者缓存值小于了当前时间戳,则显示关联店铺
				let time = uni.getStorageSync('store_subs_' + sjid)
				if (time == null || time == undefined || time < new Date().getTime()) {
					this.show_subs = true;
				}

				var that = this
				app.globalData.util.request({
					url: 'entry/wxapp/store_subs',
					data: {
						store_id: getApp().globalData.sjid
					},
					cachetime: '0',
					success: function(a) {
						that.store_subs = a.data.data
					}
				})
			},
			reLoad: function() {
				var that = this
				app.globalData.util.request({
					url: 'entry/wxapp/Url',
					cachetime: '0',
					success: function(a) {
						console.log(a.data)
						if (getApp().globalData.sjid == null || getApp().globalData.sjid == undefined || getApp().globalData
							.sjid == '') {
							return
						}
						app.globalData.util.request({
							url: 'entry/wxapp/StoreInfo',
							cachetime: '0',
							data: {
								store_id: getApp().globalData.sjid
							},
							success: function(t) {
								for (var e = 0; e < t.data.store.environment.length; e++) {
									t.data.store.environment[e] =
										a.data + t.data.store.environment[e]
								}
								for (var o = 0; o < t.data.store.yyzz.length; o++) {
									t.data.store.yyzz[o] = a.data + t.data.store.yyzz[o]
								}
								console.log(t)
								that.setData({
									store: t.data.store
								})
							}
						});
					}
				})
			},
			closehbtoggle: function() {
				this.setData({
					hbtoggle: false
				})
			},

			previewImage: function(t) {
				var a = this.store_info.qrcode
				console.log(a)
				uni.previewImage({
					current: a,
					urls: [a]
				})
			},

			sjmp: function() {
				this.setData({
					mdoaltoggle: false,
					opendh: false
				})
			},

			mdoalclose: function() {
				this.setData({
					mdoaltoggle: true
				})
			},

			opennav: function() {
				this.setData({
					opendh: !this.opendh
				})
			},

			commentPicView: function(t) {
				console.log(t)
				var a = this.storelist
				var e = []
				var s = t.currentTarget.dataset.index
				var o = t.currentTarget.dataset.picindex
				var n = t.currentTarget.dataset.id
				console.log(s, o, n)
				if (n == a[s].id) {
					var i = a[s].img
					for (var r in i) {
						e.push(this.image_url + i[r])
					}
					uni.previewImage({
						current: this.image_url + i[o],
						urls: e
					})
				}
			},

			ytpj: function() {
				var t = this.params
				if (this.isytpj) {
					t.img = ''
				} else {
					t.img = '1'
				}
				this.setData({
					pagenum: 1,
					storelist: [],
					bfstorelist: [],
					mygd: false,
					jzgd: true,
					isytpj: !this.isytpj,
					params: t
				})
				this.getstorelist()
			},

			selectednavbar: function(t) {
				console.log(t)
				var a = this.params
				if (0 == t.currentTarget.dataset.index) {
					a.type = '全部'
				}
				if (1 == t.currentTarget.dataset.index) {
					a.type = '1'
				}
				if (2 == t.currentTarget.dataset.index) {
					a.type = '2'
				}
				this.setData({
					pagenum: 1,
					storelist: [],
					bfstorelist: [],
					mygd: false,
					jzgd: true,
					selectedindex: t.currentTarget.dataset.index,
					params: a
				})
				this.getstorelist()
			},
			goUrl(name) {
				if (this.user_is_login) {
					this[name]();
				} else {
					//需要登录
					uni.reLaunch({
						url: '/ymq_canyino2o/pages/my2/index?is_show_login=1'
					})
				}
			},
			pdqh: function() {
				uni.navigateTo({
					url: 'getnum?storeid=' + this.store_info.id
				})
			},

			sy: function() {
				uni.navigateTo({
					url: 'fukuan?storeid=' + this.store_info.id
				})
			},

			qg: function() {
				uni.navigateTo({
					url: '../xsqg/xsqg?storeid=' + this.store_info.id
				})
			},

			pt: function(t) {
				uni.navigateTo({
					url: '../collage/list?store_id=' +
						this.store_info.id +
						'&store_logo=' +
						this.store_info.logo
				})
			},

			smdc: function() {
				uni.scanCode({
					success: function(t) {
						console.log(t)
						var a = '/' + t.path
						uni.navigateTo({
							url: a
						})
					},
					fail: function(t) {
						console.log('扫码fail')
					}
				})
			},

			takeout: function() {
				uni.navigateTo({
					url: '/ymq_canyino2o/pages/takeout/takeoutindex?storeid=' +
						this.store_info.id
				})
			},

			plan: function() {
				uni.navigateTo({
					url: '/ymq_canyino2o/pages/reserve/reserve?storeid=' + this.store_info.id
				})
			},

			qsy: function(t) {
				console.log(t.currentTarget.dataset.type)
				if ('2' != t.currentTarget.dataset.type) {
					uni.navigateTo({
						url: '/ymq_canyino2o/pages/takeout/takeoutindex?storeid=' +
							this.store_info.id
					})
				}
			},

			ljlq: function(t) {
				console.log(t.currentTarget.dataset.qid)
				var that = this
				var e = uni.getStorageSync('users').id
				uni.showLoading({
					title: '正在加载',
					mask: true
				})
				app.globalData.util.request({
					url: 'entry/wxapp/LqCoupons',
					cachetime: '0',
					data: {
						user_id: e,
						coupon_id: t.currentTarget.dataset.qid
					},
					success: function(t) {
						console.log(t)
						if ('1' == t.data) {
							uni.showLoading({
								title: '领取成功',
								mask: true
							})
							setTimeout(function() {
								that.CouponsFun()
							}, 1000)
						}
					}
				})
			},

			getstorelist: function() {
				var that = this
				var o = that.pagenum
				that.params.page = o
				that.params.pagesize = 10
				if (that.params.store_id == null || that.params.store_id == '') {
					return
				}
				console.log(o, that.params)
				that.setData({
					isjzz: true
				})
				app.globalData.util.request({
					url: 'entry/wxapp/AssessList',
					cachetime: '0',
					data: that.params,
					success: function(t) {
						console.log('分页返回的商家列表数据', t.data)
						var a = [{
								name: '全部',
								num: t.data.all
							},
							{
								name: '满意',
								num: t.data.ok
							},
							{
								name: '不满意',
								num: t.data.no
							}
						]
						var e = that.bfstorelist
						e = (function(t) {
							for (var a = [], e = 0; e < t.length; e++) {
								if (-1 == a.indexOf(t[e])) {
									a.push(t[e])
								}
							}
							return a
						})((e = e.concat(t.data.assess)))
						that.setData({
							storelist: e,
							bfstorelist: e,
							navbar: a
						})
						if (t.data.assess.length < 10) {
							that.setData({
								mygd: true,
								jzgd: true,
								isjzz: false
							})
						} else {
							that.setData({
								jzgd: true,
								pagenum: o + 1,
								isjzz: false
							})
						}
						console.log(e)
					}
				})
			},

			CouponsFun: function() {
				var that = this
				var t = uni.getStorageSync('users').id
				app.globalData.util.request({
					url: 'entry/wxapp/Coupons',
					cachetime: '0',
					data: {
						store_id: getApp().globalData.sjid,
						user_id: t
					},
					success: function(t) {
						console.log("优惠券列表:", t.data)
						for (var a = [], e = 0; e < t.data.length; e++) {
							t.data[e].sysl = parseInt(((Number(t.data[e].number) - Number(t.data[e].stock)) / Number(t.data[e]
								.number)) * 100)
						}
						for (var s = 0; s < t.data.length; s++) {
							if ('2' == t.data[s].state && t.data[s].sysl < 100) {
								a.push(t.data[s])
							}
						}
						that.setData({
							Coupons: t.data,
							wlqyhq: a,
							hbtoggle: 0 < a.length
						})
						console.log(a)
					}
				})
			},

			jumps: function(t) {
				var a = t.currentTarget.dataset.id
				var e = t.currentTarget.dataset.name
				var s = t.currentTarget.dataset.appid
				var o = t.currentTarget.dataset.src
				var n = t.currentTarget.dataset.wb_src
				var i = t.currentTarget.dataset.type
				console.log(a, e, s, o, n, i)
				if (1 == i) {
					console.log(o)
					uni.navigateTo({
						url: o
					})
				} else {
					if (2 == i) {
						uni.setStorageSync('vr', n)
						uni.navigateTo({
							url: '../car/car'
						})
					} else {
						if (3 == i) {
							uni.navigateToMiniProgram({
								appId: s
							})
						}
					}
				}
			},

			refresh: function(t) {
				var that = this
				var c = util.formatTime(new Date()).slice(11, 16)
				app.globalData.util.request({
					url: 'entry/wxapp/StoreInfo',
					cachetime: '0',
					data: {
						store_id: t
					},
					success: function(t) {
						console.log('商家详情')
						console.log(t)
						if ('' != t.data.store.store_mp3 && '1' == t.data.store.is_mp3) {
							// #ifdef MP-WEIXIN
							wx.playBackgroundAudio({
								dataUrl: t.data.store.store_mp3
							})
							uni.getBackgroundAudioPlayerState({
								success: function(t) {
									console.log(t)
									t.status
									t.dataUrl
									t.currentPosition
									t.duration
									t.downloadPercent
								},
								fail: function(t) {
									console.log(t)
								},
								complete: function(t) {
									console.log(t)
								}
							})
							// #endif
						}
						uni.setNavigationBarTitle({
							title: t.data.store.name
						})
						var a = t.data.store.tel
						that.setData({
							store_info: t.data.store,
							storeset: t.data.storeset,
							paytel: '1' == getApp().globalData.xtxx.is_pay &&
								0 < Number(getApp().globalData.xtxx.pay_money) ?
								a.substring(0, 3) + '****' + a.substring(a.length - 4) : a
						})
						var e = t.data.storeset
						var s = that.nav
						if ('1' == e.is_dn) {
							s[1].active = true
							if ('' != e.dn_img) {
								s[1].img = e.dn_img
							}
							if ('' != e.dn_name) {
								s[1].name = e.dn_name
							}
							if ('' != e.dnsm) {
								s[1].smwz = e.dnsm
							}
						}
						if ('1' == e.is_wm) {
							s[0].active = true
							if ('' != e.wm_img) {
								s[0].img = e.wm_img
							}
							if ('' != e.wm_name) {
								s[0].name = e.wm_name
							}
							if ('' != e.wmsm) {
								s[0].smwz = e.wmsm
							}
						}
						if ('1' == e.is_yy) {
							s[2].active = true
							if ('' != e.yy_img) {
								s[2].img = e.yy_img
							}
							if ('' != e.yy_name) {
								s[2].name = e.yy_name
							}
							if ('' != e.sysm) {
								s[2].smwz = e.yysm
							}
						}
						if ('1' == e.is_sy) {
							s[3].active = true
							if ('' != e.sy_img) {
								s[3].img = e.sy_img
							}
							if ('' != e.sy_name) {
								s[3].name = e.sy_name
							}
							if ('' != e.sysm) {
								s[3].smwz = e.sysm
							}
						}
						if ('1' == e.is_qg && '1' == getApp().globalData.xtxx.qggn) {
							s[4].active = true
							if ('' != e.qg_img) {
								s[4].img = e.qg_img
							}
							if ('' != e.qg_name) {
								s[4].name = e.qg_name
							}
							if ('' != e.qgsm) {
								s[4].smwz = e.qgsm
							}
						}
						if ('1' == e.is_pt && '1' == getApp().globalData.xtxx.ptgn) {
							s[5].active = true
							if ('' != e.pt_img) {
								s[5].img = e.pt_img
							}
							if ('' != e.pt_name) {
								s[5].name = e.pt_name
							}
							if ('' != e.ptsm) {
								s[5].smwz = e.ptsm
							}
						}
						if ('1' == e.is_pd) {
							s[6].active = true
							if ('' != e.pd_img) {
								s[6].img = e.pd_img
							}
							if ('' != e.pd_name) {
								s[6].name = e.pd_name
							}
							if ('' != e.pdsm) {
								s[6].smwz = e.pdsm
							}
						}
						console.log("店铺支持模块", s)
						//遍历店铺模块s,如果仅仅开启了外卖模块,则跳转到外卖下单界面
						var isOnlyWm = true
						for (var i = 0; i < s.length; i++) {
							if (s[i].active && s[i].bindtap != 'takeout') {
								isOnlyWm = false
								break
							}
						}
						if (isOnlyWm && that.store_info.id != undefined) {
							uni.navigateTo({
								url: '/ymq_canyino2o/pages/takeout/takeoutindex?storeid=' + that.store_info.id
							})
							return
						}

						that.setData({
							nav: s
						})


						var o = t.data.store.time
						var n = t.data.store.time2
						var i = t.data.store.time3
						var r = t.data.store.time4
						var d = t.data.store.is_rest
						console.log('当前的系统时间为' + c)
						console.log('商家的营业时间从' + o + '至' + n, i + '至' + r)
						if (1 != d) {
							console.log('商家正在营业' + d)
							if (o < r) {
								if ((o < c && c < n) || (i < c && c < r) || (i < c && r < i)) {
									console.log('商家正常营业'),
										that.setData({
											time: 1
										})
								} else {
									if (c < o || (n < c && c < i)) {
										console.log('商家还没开店呐，稍等一会儿可以吗？'),
											that.setData({
												time: 2
											})
									} else {
										r < c &&
											(console.log('商家以及关店啦，明天再来吧'),
												that.setData({
													time: 3
												}))
									}
								}
							} else {
								r < o &&
									((o < c && c < n) || (i < c && r < c) || (c < i && c < r) ?
										(console.log('商家正常营业'),
											that.setData({
												time: 1
											})) :
										c < o || (n < c && c < i) ?
										(console.log('商家还没开店呐，稍等一会儿可以吗？'),
											that.setData({
												time: 2
											})) :
										r < c &&
										(console.log('商家以及关店啦，明天再来吧'),
											that.setData({
												time: 3
											})))
							}
						} else {
							that.setData({
								time: 2
							})
						}
					}
				})
			},

			seller_coupon: function() {
				this.setData({
					index: 0
				})
			},

			seller_dishes: function() {
				this.setData({
					index: 1
				})
			},

			seller_evalate: function() {
				this.setData({
					index: 2
				})
			},

			seller_info: function(t) {
				var a = this.store_info.coordinates.split(',')
				var e = this.store_info
				console.log(a)
				uni.openLocation({
					latitude: parseFloat(a[0]),
					longitude: parseFloat(a[1]),
					address: e.address,
					name: e.name
				})
			},

			maketel: function(t) {
				var that = this
				var e = this.store_info.tel
				var s = this.paytel
				console.log(s)
				if ('-1' != s.indexOf('****')) {
					uni.showModal({
						title: '提示',
						content: '查看电话需付费' + getApp().globalData.xtxx.pay_money + '元',
						success: function(t) {
							if (t.confirm) {
								console.log('用户点击确定')
								app.globalData.util.request({
									url: 'entry/wxapp/telPay',
									cachetime: '0',
									data: {
										openid: that.userinfo.openid,
										pay_money: getApp().globalData.xtxx.pay_money
									},
									success: function(t) {
										uni.requestPayment({
											timeStamp: t.data.timeStamp,
											nonceStr: t.data.nonceStr,
											package: t.data.package,
											signType: t.data.signType,
											paySign: t.data.paySign,
											success: function(t) {
												console.log(t)
											},
											complete: function(t) {
												console.log(t)
												if ('requestPayment:fail cancel' == t.errMsg) {
													uni.showToast({
														title: '取消支付'
													})
												}
												if ('requestPayment:ok' == t.errMsg) {
													uni.showToast({
														title: '支付成功',
														duration: 1000
													})
													that.setData({
														paytel: e
													})
												}
											}
										})
									}
								})
							}
						}
					})
				} else {
					uni.makePhoneCall({
						phoneNumber: e
					})
					that.setData({
						paytel: e
					})
				}
			},

			gbbjyy: function() {
				var t = this.bjyylb
				// #ifdef MP-WEIXIN
				if ('laba' == t) {
					uni.stopBackgroundAudio()
					this.setData({
						bjyylb: 'laba1'
					})
					uni.showToast({
						title: '音乐已关闭'
					})
				}
				if ('laba1' == t) {
					uni.playBackgroundAudio({
						dataUrl: this.store_info.store_mp3
					})
					this.setData({
						bjyylb: 'laba'
					})
					uni.showToast({
						title: '音乐已开启'
					})
				}
				// #endif
			}
		}
	}
</script>
<style>
	@import './index.css';
</style>